package com.test.thread.concurrent;

import java.util.List;
import java.util.concurrent.Semaphore;

public class T {

	public static void main(String[] args) {
		
		InitThread initThread=new InitThread(new Semaphore(0));//初始化一个子线程，传一个初值为0的信号量给它
//		Display.getDefault().asyncExec(initThread);		
		try {//此处会挂起，直到子线程完成工作，修改了信号量的值，主线程才会继续
			initThread.getSemaphore().acquire();
			
		} catch (InterruptedException e1) {			
//			insertConsoleText("数据获取失败……/n");
		}
	}
}


class InitThread implements Runnable{
	private Semaphore semaphore;
	public InitThread(Semaphore semaphore){
		this.semaphore=semaphore;
	}
	
	public Semaphore getSemaphore() {
		return semaphore;
	}
	@SuppressWarnings("unchecked")
	public void run() {
		
		////
		semaphore.release();
	}
}